 $(function() {


     var windowHeight = $(window).height();
     var footheight = $("footer").height();
     // $(".articlebox").css("height", windowHeight - footheight - 110);
     $(".box").css("height", windowHeight - footheight);

     var imgsboxWidth = $(".imgsbox").width();
     $(".inner").css("width", imgsboxWidth * 5);
     $(".inner>a").css("width", imgsboxWidth);
     $(".all").css("width", imgsboxWidth);



     $(window).load(function() {
         console.log(box.topimgs);
         $(".pointer span:nth-child(1)").addClass('color');

         var $pointer = $('.pointer span');
         var flipsnap = Flipsnap('.inner', {
             distance: imgsboxWidth
         });
         flipsnap.element.addEventListener('fsmoveend', function() {
             $pointer.filter('.color').removeClass('color'); //filter 为jquery的筛选器，筛选出与指定表达式匹配的元素集合  
             $pointer.eq(flipsnap.currentPoint).addClass('color');
         }, false);



     });



     var box = new Vue({
         el: '.box',
         data: datalist,
         components: {
             myFoot
         },
         methods: {
             choosemune: function(i) {
                 window.location.href = menulist[i];
             },
             findArticle: function() {
                 this.articles.splice(0, this.articles.length);
                 $.ajax({
                     type: "GET",
                     url: "../article/queryNews?title=" + this.title + '&type=' + this.type,
                     dataType: "json",
                     success: function(ret) {
                         console.log(ret);
                         if (ret.code == 0) {
                             if (ret.data.length > 0) {
                                 ret.data.reverse();
                                 $.each(ret.data, function(index, val) {
                                     var time = new Date(parseInt(val.createTime)).toLocaleString().replace(/:\d{1,2}$/, ' ');
                                     console.log(time);
                                     val.createTime = time;
                                     if (val.title != null) {
                                         box.articles.push(val);
                                     }



                                 });

                             } else {

                             }
                         } else {
                             alert(ret.message);

                         }
                     }
                 });


             },
             jump: function(id) {
                 window.location.href = menulist[4] + '?id=' + id;
             }
         }
     })
     $("footer ul li").removeClass("active");
     $("footer ul li:nth(0)").addClass("active");
     box.findArticle();
 })
